<!-- 用户列表 -->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>
        back_blog - <%= title %>
    </title>
</head>
<link rel="shortcut icon" href="./images/favicon.ico">
<link rel="stylesheet" href="./bootstrap/css/bootstrap.css">
<link rel="stylesheet" href="./stylesheets/public.css">
<link rel="stylesheet" href="./stylesheets/manageauthors.css">

<body>
    <div class="blogwrap">
        <%- include head %>
            <div class="navbarconent col-md-12 col-sm-12 col-xs-12">
                <div class="boxContent">
                    <div class="navtitle clearfix">
                        <ol class="breadcrumb">
                            <li><a href="/">主页</a></li>
                            <li><a href="/manageauthors">用户管理</a></li>
                        </ol>
                    </div>
                    <div class="authorlists">
                        <p class="title">用户列表</p>
                        <a class="btn btn-primary" data-toggle="modal" data-target="#signIn" title="添加用户">添加用户</a>
                        <table class="table table-bordered table-striped with-check"
                            style="word-break:break-all; word-wrap:break-all;">
                            <thead>
                                <tr>
                                    <th>用户id</th>
                                    <th>用户名</th>
                                    <th>用户邮箱</th>
                                    <th>用户密码</th>
                                    <th>座右铭</th>
                                    <th>用户头像</th>
                                    <th>操作</th>
                                </tr>
                            </thead>
                            <tbody>
                                <% for(let i in userlist.list){ %>
                                    <tr>
                                        <td>
                                            <%= userlist.list[i]._id %>
                                        </td>
                                        <td>
                                            <%= userlist.list[i].author %>
                                        </td>
                                        <td>
                                            <%= userlist.list[i].email %>
                                        </td>
                                        <td title="unreadable">
                                            ***
                                        </td>
                                        <td>
                                            <%= userlist.list[i].motto %>
                                        </td>
                                        <td>
                                            <img src="<%= userlist.list[i].headImg%>">
                                        </td>
                                        <td>
                                            <a class="btn btn-danger"
                                                delhref="/deleteauthor?id=<%= userlist.list[i]._id%>&page=<%= userlist.curPage%>">删除</a>
                                            <a class="btn btn-primary" title="修改用户信息" href="/editauthorinfo?id=<%= userlist.list[i]._id %>&page=<%= userlist.curPage%>">修改</a>
                                        </td>
                                    </tr>
                                    <%}%>
                            </tbody>
                        </table>
                    </div>
                    <div class="paging">
                        <p class="totalpage"><a>共<%= userlist.total %>页</a></p>
                        <ul class="pagination" title=<%=userlist.curPage%>>
                            <% for(let j=1;j <=userlist.total; j++){ %>
                                <li>
                                    <a href="/manageauthors?page=<%= j%>">
                                        <%= j%>
                                    </a>
                                </li>
                                <% } %>
                        </ul>
                    </div>
                </div>
            </div>
            <!-- 添加用户 -->
            <div class="modal fade" id="signIn" tabindex="-1" role="dialog" aria-labelledby="signInLabel"
                aria-hidden="true">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                            <h4 class="modal-title" id="signInLabel">添加用户</h4>
                        </div>
                        <div class="modal-body">
                            <form class="form-horizontal" action="/email" method="post" id="signInform">
                                <div class="form-group mb10">
                                    <label class="col-md-3 col-sm-3">用户名：</label>
                                    <div class="col-md-8 col-sm-8">
                                        <input type="text" class="form-control" placeholder="请输入用户名：" id="authorname" name="authorname">
                                    </div>
                                </div>
                                <div class="form-group mb10">
                                    <label class="col-md-3 col-sm-3">密码：</label>
                                    <div class="col-md-8 col-sm-8">
                                        <input type="text" class="form-control" placeholder="请输入密码：" id="password" name="password">
                                    </div>
                                </div>
                                <div class="form-group mb10">
                                    <label class="col-md-3 col-sm-3">邮箱：</label>
                                    <div class="col-md-8 col-sm-8">
                                        <input type="text" class="form-control" placeholder="请输入邮箱：" id="email" name="email">
                                    </div>
                                </div>
                                <div class="modal-footer">
                                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                                    <button type="button" class="btn btn-primary" type="submit" id="tosignIn">submit</button>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>

    </div>
</body>
<script src="./javascripts/jquery.min.js"></script>
<script src="./bootstrap/js/bootstrap.min.js"></script>
<script src="./javascripts/sweetalert2@8.js"></script>
<script src="./javascripts/manageauthors.js"></script>

</html>